package com.foreknow.demo10;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateDemo {
    public static void main(String[] args) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = sdf.format(date);
        System.out.println(format);
        Calendar calendar = Calendar.getInstance();
        calendar.set(2021,6,29);
        Date calendarTime = calendar.getTime();
        System.out.println(sdf.format(calendarTime));
    }
}
